import { createRouter, createWebHistory, createWebHashHistory } from "vue-router"

export const silderlist = ['/home']

export const needlessAuthorRouter = [
    {
        path: '/syStandardLib',
        name: 'syStandardLib',
        component: () => import('@/pages/layout/index.vue'),
        redirect: '/syStandardLib/caselibrary',
        meta: {
            title: '试验标准库',
            isHide: false,
            icon: 'home',
            key: 'syStandardLib'
        },
        children: [
            {
                path: 'caselibrary',
                name: 'caselibrary',
                component: () => import('@/pages/syStandardLib/caselibrary.vue'),
                meta: {
                    title: '台架试验CASE库',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    key: 'syStandardLib&&caselibrary'
                },
                children: []
            },
            {
                path: 'caselibrary/create',
                component: () => import('@/pages/syStandardLib/caselibrary/create.vue'),
                name: 'caselibraryCreate',
                meta: {
                    title: '新增台架试验CASE库',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/caselibrary'
                },
            }, {
                path: 'caselibrary/view/:id',
                component: () => import('@/pages/syStandardLib/caselibrary/detail.vue'),
                name: 'viewcaselibrary',
                meta: {
                    title: '查看台架试验CASE库',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/caselibrary'
                },
            }, {
                path: 'caselibrary/edit/:id',
                component: () => import('@/pages/syStandardLib/caselibrary/edit.vue'),
                name: 'caselibraryEdit',
                meta: {
                    title: '编辑台架试验CASE库',
                    isHide: true,
                    activeMenu: '/syStandardLib/caselibrary'
                },
            },
            /* ---------- */
            {
                path: 'casepackage',
                name: 'casepackage',
                component: () => import('@/pages/syStandardLib/casepackage.vue'),
                meta: {
                    title: '台架试验CASE包',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    key: 'syStandardLib&&casepackage'
                }
            },
            {
                path: 'casepackage/create',
                component: () => import('@/pages/syStandardLib/casepackage/create.vue'),
                name: 'casepackageCreate',
                meta: {
                    title: '新增台架试验CASE包',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/casepackage'
                },
            }, {
                path: 'casepackage/view/:id',
                component: () => import('@/pages/syStandardLib/casepackage/detail.vue'),
                name: 'viewcasepackage',
                meta: {
                    title: '查看台架试验CASE包',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/casepackage'
                },
            }, {
                path: 'casepackage/edit/:id',
                component: () => import('@/pages/syStandardLib/casepackage/edit.vue'),
                name: 'casepackageEdit',
                meta: {
                    title: '编辑台架试验CASE包',
                    isHide: true,
                    activeMenu: '/syStandardLib/casepackage'
                },
            },
            /* ---------- */
            {
                path: 'minimumCell',
                name: 'minimumCell',
                component: () => import('@/pages/syStandardLib/minimumCell.vue'),
                meta: {
                    title: '最小试验单元',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    key: 'syStandardLib&&minimumCell'
                }
            },
            /* ---------- */
            {
                path: 'vehicleTestLibrary',
                name: 'vehicleTestLibrary',
                component: () => import('@/pages/syStandardLib/vehicleTestLibrary.vue'),
                meta: {
                    title: '整车试验CASE库',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    key: 'syStandardLib&&vehicleTestLibrary'
                }
            },
            {
                path: 'vehicleTestLibrary/create',
                component: () => import('@/pages/syStandardLib/vehicleTestLibrary/create.vue'),
                name: 'vehicleTestLibraryCreate',
                meta: {
                    title: '新增整车试验CASE库',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/vehicleTestLibrary'
                },
            }, {
                path: 'vehicleTestLibrary/view/:id',
                component: () => import('@/pages/syStandardLib/vehicleTestLibrary/detail.vue'),
                name: 'vehicleTestLibraryView',
                meta: {
                    title: '查看整车试验CASE库',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/vehicleTestLibrary'
                },
            }, {
                path: 'vehicleTestLibrary/edit/:id',
                component: () => import('@/pages/syStandardLib/vehicleTestLibrary/edit.vue'),
                name: 'vehicleTestLibraryEdit',
                meta: {
                    title: '编辑case信息',
                    isHide: true,
                    activeMenu: '/syStandardLib/vehicleTestLibrary'
                },
            },
            /* ---------- */
            {
                path: 'vehicleTestPackage',
                name: 'vehicleTestPackage',
                component: () => import('@/pages/syStandardLib/vehicleTestPackage.vue'),
                meta: {
                    title: '整车试验CASE包',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    key: 'syStandardLib&&vehicleTestPackage'
                }
            },
             {
                path: 'vehicleTestPackage/create',
                component: () => import('@/pages/syStandardLib/vehicleTestPackage/create.vue'),
                name: 'vehicleTestPackageCreate',
                meta: {
                    title: '新增整车试验CASE包',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/vehicleTestPackage'
                },
            }, {
                path: 'vehicleTestPackage/view/:id',
                component: () => import('@/pages/syStandardLib/vehicleTestPackage/detail.vue'),
                name: 'vehicleTestPackageView',
                meta: {
                    title: '查看整车试验CASE库',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: false,
                    activeMenu: '/syStandardLib/vehicleTestPackage'
                },
            }, {
                path: 'vehicleTestPackage/edit/:id',
                component: () => import('@/pages/syStandardLib/vehicleTestPackage/edit.vue'),
                name: 'vehicleTestPackageEdit',
                meta: {
                    title: '编辑case信息',
                    isHide: true,
                    activeMenu: '/syStandardLib/vehicleTestPackage'
                },
            },
            /* ---------- */
        ]
    },
    {
        path: '/systemManage',
        name: 'systemManage',
        component: () => import('@/pages/layout/index.vue'),
        redirect: '/systemManage/userManagement',
        meta: {
            title: '通用设置',
            isLink: '',
            isHide: false,
            isKeepAlive: true,
            icon: 'iconfont icon-xitongshezhi',
        },
        children: [
            {
                path: 'userManagement',
                name: 'userManagement',
                component: () => import('@/pages/systemManage/userManagement.vue'),
                meta: {
                    title: '用户管理',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                },
                operating: [{
                    label: "查看",
                    value: "look"
                }, {
                    label: "新增",
                    value: "add"
                }],
            },
            {
                path: 'userManagement/create',
                name: 'create_user',
                component: () => import('@/pages/systemManage/userManagement/create.vue'),
                meta: {
                    title: '新增用户',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: true,
                }
            },
            {
                path: 'departmentMan',
                name: 'departmentMan',
                component: () => import('@/pages/systemManage/departmentMan.vue'),
                meta: {
                    title: '科室角色管理',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                }
            },
            {
                path: 'departmentMan/users',
                name: 'departmentMan_users',
                component: () => import('@/pages/systemManage/departmentMan/users.vue'),
                meta: {
                    title: '科室-用户信息',
                    isLink: '',
                    isHide: true,
                    isKeepAlive: true,
                }
            },
            {
                path: 'sysmenuManagement',
                name: 'sysmenuManagement',
                component: () => import('@/pages/systemManage/sysmenuManagement.vue'),
                meta: {
                    title: '权限管理',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                }
            },
            {
                path: 'logManagement',
                name: 'logManagement',
                component: () => import('@/pages/systemManage/logManagement.vue'),
                meta: {
                    title: '日志管理',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                }
            }
        ]
    }
]

export const noLimitRouter = [
    {
        path: '/home',
        component: () => import('@/pages/layout/index.vue'),
        meta: {
            title: '主页',
            icon: 'home',
            key: 'home'
        },
        only: true,
        children: [
            {
                path: '',
                name: 'home',
                component: () => import('@/pages/home/index.vue')
            }
        ]
    }
]

export const notFoundAndNoPower = [
    {
        path: '/:path(.*)*',
        name: 'notFound',
        component: () => import('@/pages/error/404.vue'),
        meta: {
            title: '404',
            isHide: true,
        },
    },
    {
        path: '/401',
        name: 'noPower',
        component: () => import('@/pages/error/401.vue'),
        meta: {
            title: '401',
            isHide: true,
        },
    },
    {
        path: '/',
        name: 'login',
        component: () => import('@/pages/login/index.vue'),
        meta: {
            title: '登录',
        }
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes: [...needlessAuthorRouter, ...noLimitRouter, ...notFoundAndNoPower]
})

export default router